<%@ page pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ page trimDirectiveWhitespaces="true" %>
<fmt:setLocale value="zh_CN"/>

<!--  模板table,模板中不能初始化 -->
<select name="dataType" class="required ignore ora_dbcolumntype">
	<optgroup label="字符">
		<option value="varchar2">varchar2()</option>
		<option value="nvarchar2">nvarchar2()</option>
		<option value="char">char()</option>
	</optgroup>
	<optgroup label="数字">
		<option value="number">number()</option>
		<option value="binary_float">binary_float</option>
		<option value="binary_double">binary_double</option>
	</optgroup>
	<optgroup label="时间">
		<option value="date">date</option>
		<option value="timestamp">timestamp</option>
	</optgroup>
	<optgroup label="大对象">
		<option value="clob">clob</option>
		<option value="blob">blob</option>
		<option value="long">long</option>
		<option value="nclob">nclob</option>
	</optgroup>
	<option value="raw">raw()</option>
</select>
   
<script>

$(".dbcolumntype").html($(".ora_dbcolumntype").html());
$(":input[name=dataType]").filter("select").each(function(){
	var $this = $(this);
	$this.find("option").eq(0).prop("selected", true);
});
$(":input[name=dataType]").filter(function(){
	return $(this).val()=="bigint";
}).each(function(){
	var $this = $(this);
	$this.val("number");
	$this.closest("tr").find("[name='datasize']").val("");
});
$(":input[name=dataType]").filter(function(){
	return $(this).val()=="timestamp";
}).each(function(){
	var $this = $(this);
	$this.val("date");
	$this.closest("tr").find("[name='datasize']").val("");
});
$(":input[name=dataType]").filter(function(){
	return $(this).val()=="varchar";
}).each(function(){
	var $this = $(this);
	$this.val("varchar2");
});
//默认值处理
$(":input[name=default]").filter(function(){
	return $(this).val();
}).each(function(){
	var $this = $(this);
	var dataType = $this.closest("tr").find("[name='dataType']").val();
	if(dataType == "date"){
		$this.val("sysdate");
	}
});
</script>
		